var api_course_duration = "./";
var api_busy_time = "./t";
var api_course_list = './course_list.txt';
var api_doctor_list = './doctor_list.txt';
var api_add_source = "./api_add_course/";

function get_data () {
	for(i=0;i<course.length;i++){
		if(course[i][5]==1){
			get_course_duration(i);
		}
	}
};



function get_course_duration (i) {
	this.time_handler = function (data, i) {
		dur_time = dur_time + parseInt(data[1],10);
		course[i][6]=data[1];
get_busy_time (i);
	};
	this.time_conn = new Ajax("", this.time_handler, i);
	this.time_conn.url = api_course_duration + i + ".txt";	//TODO:use the url below if release
//        this.time_conn.url = api_course_duration + "course=" + course[i][0] + "&doctor=" + course[i][4];
	this.time_conn.make_request();

};

function get_busy_time (i) {
        this.time_handler = function (data, i) {
		var tmp = new Array();
		tmp = data;
                course[i][9]=tmp;
		fmgr.objects[0].userdata.table_show(fmgr.objects[0].userdata);
        };
        this.time_conn = new Ajax("", this.time_handler, i);
        this.time_conn.url = api_busy_time + i + ".txt";  //TODO:use the url below if release
                var year = document.getElementById("year").value;
                var month= document.getElementById("month").value;
                var day= document.getElementById("day").value;
//        this.time_conn.url = api_busy_time + "course=" + course[i][0] + "&doctor=" + course[i][4] + "&year=" + year + "&month=" + month + "&day=" +day;
        this.time_conn.make_request();
	

};

